package com.bw.mine.view

import androidx.recyclerview.widget.GridLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.blankj.utilcode.util.ToastUtils
import com.bw.base.constants.RoutePath
import com.bw.common.view.BaseMvvmFragment
import com.bw.mine.R
import com.bw.mine.databinding.FragmentMineBinding

import com.bw.mine.viewmodel.MineViewModel
import com.bw.mine.adapter.MineAdapter
import com.bw.mine.entity.MineEntity
import com.bw.mine.module.MineData


@Route(path = RoutePath.PATH_MINE_FRAGMENT)
class MineFragment : BaseMvvmFragment<FragmentMineBinding,MineViewModel>() {

    private lateinit var adapter: MineAdapter


    override fun initView() {

        binding.llLoginInfo.setOnClickListener {
            ARouter.getInstance().build(RoutePath.PATH_LOGIN).navigation()
        }


        adapter = MineAdapter()
        adapter.data.clear()
        adapter.data.addAll(MineData.mineList)
        binding.mineRv.adapter = adapter

        binding.mineRv.layoutManager = GridLayoutManager(context,4)


        adapter.setOnItemClickListener { mAdapter, view, position  ->
            val entity = adapter.data[position]
            ToastUtils.showShort(entity.title)
        }


    }

    override fun initData() {

    }

}